import React from 'react'
import ReactDOM from 'react-dom/client'
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import { ConfigProvider } from 'antd';   // 新增 ConfigProvider
import zhCN from 'antd/locale/zh_CN';    // v5 专用中文包
import dayjs from 'dayjs';               // v5 改用 dayjs
import 'dayjs/locale/zh-cn';             // 配置 dayjs 中文
import store from "./store/store.js"
import { Provider } from "react-redux";
import Index from "./routes/Index.jsx";
import Charge from "./routes/Charge.jsx";

// 配置 dayjs 中文（必须！否则日期类组件仍是英文）
dayjs.locale('zh-cn');

const router = createBrowserRouter([
    {
        path: "/",
        element: <Index/>
    },
    {
        path: "/charge",
        element: <Charge/>
    }
])

ReactDOM.createRoot(document.getElementById('root')).render(
    <React.StrictMode>
        <Provider store={store}>
            {/* 包裹 ConfigProvider */}
            <ConfigProvider locale={zhCN}>
                <RouterProvider router={router}/>
            </ConfigProvider>
        </Provider>
    </React.StrictMode>
)